#controlled contecst manager
class controlled_execution:
    
    a = 10
    
    def test(self):
        print "test"
        
    def __enter__(self):
        
        #return instance
        return self
    
    def __exit__(self, type, value, traceback):
        
        print self
        
with controlled_execution() as thing:
    thing.test()
    print thing.a
    
    
